<!DOCTYPE html>
<html lang="pt-br">
	<head>
		<meta charset="utf-8" />
		<base href="../../../" />
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
	</head>
	<body>
		<h1>[name]</h1>

		<p class="desc">
			Cria um objeto AudioAnalyser, que usa um [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode AnalyserNode]
			para analisar informações de audio.<br /><br />

			Utiliza a [link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API Web Audio API].
		</p>

		<h2>Exemplo de Código</h2>

		<code>
		// create an AudioListener and add it to the camera
		const listener = new THREE.AudioListener();
		camera.add( listener );

		// create an Audio source
		const sound = new THREE.Audio( listener );

		// load a sound and set it as the Audio object's buffer
		const audioLoader = new THREE.AudioLoader();
		audioLoader.load( 'sounds/ambient.ogg', function( buffer ) {
			sound.setBuffer( buffer );
			sound.setLoop(true);
			sound.setVolume(0.5);
			sound.play();
		});

		// create an AudioAnalyser, passing in the sound and desired fftSize
		const analyser = new THREE.AudioAnalyser( sound, 32 );

		// get the average frequency of the sound
		const data = analyser.getAverageFrequency();
		</code>

		<h2>Exemplos</h2>

		<p>
			[example:webaudio_sandbox webaudio / sandbox ]<br />
			[example:webaudio_visualizer webaudio / visualizer ]
		</p>

		<h2>Construtor</h2>


		<h3>[name]( audio, [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize fftSize] )</h3>
		<p>
		Cria um novo [page:AudioAnalyser AudioAnalyser].
		</p>


		<h2>Propriedades</h2>

		<h3>[property:AnalyserNode analyser]</h3>
		<p>Um [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode AnalyserNode] usado para analisar áudio.</p>

		<h3>[property:Integer fftSize]</h3>
		<p>
		Uma potência diferente de zero que vai de 2 até 2048, representando o tamanho da FFT (Fast Fourier Transform - Transformada Rápida de Fourier) a ser usada para determinar o domínio da frequência.
		Ver [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize esse link] para detalhes.
		</p>

		<h3>[property:Uint8Array data]</h3>
		<p>
		Um Uint8Array com tamanho determinado por [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/frequencyBinCount analyser.frequencyBinCount]
		usado para armazenar dados de análise.
		</p>


		<h2>Métodos</h2>


		<h3>[method:Uint8Array getFrequencyData]()</h3>
		<p>
		Usa o método [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData getByteFrequencyData] do Web Audio.
		Veja essa página.
		</p>

		<h3>[method:Number getAverageFrequency]()</h3>
		<p>
		Obtenha a média das frequências retornadas pelo método [page:AudioAnalyser.getFrequencyData getFrequencyData].
		</p>

		<h2>Source</h2>

		<p>
			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
		</p>
	</body>
</html>
